import { BaseEntity } from '../../base/entity/base';
import { Column, Entity, Index } from 'typeorm';

/**
 * 订单信息
 */
@Entity('order_order')
export class OrderOrderEntity extends BaseEntity {
  @Index({ unique: true })
  @Column({ comment: '订单编号' })
  orderNo: string;

  @Column({ comment: '支付金额', type: 'decimal', precision: 10, scale: 2 })
  payAmount: number;

  @Column({ comment: '支付类型', default: 1 })
  payType: number;

  @Column({
    comment: '支付状态',
    dict: ['待支付', '已支付', '已关闭', '已退款'],
    default: 0,
  })
  payStatus: number;

  @Column({ comment: '支付时间', nullable: true })
  payTime: number;

  @Column({ comment: '支付用户ID', nullable: true })
  payUserId: number;

  // 设备号
  @Column({ comment: '设备号' })
  deviceNo: string;

  // 设备归属人
  @Column({ comment: '设备归属人ID', nullable: true })
  deviceBindUserId: number;

  @Column({ comment: '退款原因', nullable: true })
  refundReason: string;

  @Column({ comment: '退款时间', nullable: true })
  refundTime: Date;

  @Column({ comment: '退款金额', type: 'decimal', precision: 10, scale: 2, nullable: true })
  refundAmount: number;

  // 是否完成投币
  @Column({ comment: '是否完成投币', default: false })
  isComplete: boolean;

  // 套餐内容
  @Column({ comment: '套餐内容', nullable: true })
  packageContent: string;

  // 投币次数
  @Column({ comment: '投币次数', default: 0 })
  gameCount: number;

  // 设备归属直接代理id
  @Column({ comment: '设备归属直接代理id', nullable: true })
  deviceBindAgentId: number;

  // 微信openid
  @Column({ comment: '微信openid', nullable: true })
  openId: string;
}
